package aad.storyboard.model;

import aad.storyboard.controller.FrameRateController;

public class AnimationStateStarted implements AnimationState{

	private static AnimationStateStarted instance = new AnimationStateStarted();
	
	private AnimationStateStarted(){
		
	}
	
	public static AnimationStateStarted getInstance(){
		return instance;
	}
	
	@Override
	public void stop(Animation a) {
		a.setActive(false);
		a.setState(AnimationStateStopped.getInstance());
		Animation stackanimation = a.clone();
		a.resetCurrentDuration();
		stackanimation.adjustParameters();
		AnimationProvider.getInstance().addAnimationToStack(stackanimation);
		FrameRateController.unsubscribeObserver(a);
	}

	@Override
	public void pause(Animation a) {
		a.setActive(false);
		a.setState(AnimationStatePaused.getInstance());
	}

	@Override
	public void start(Animation a) {
		//nothing happens, already started
	}

}
